# coding=utf-8
import smtplib
from email.mime.text import MIMEText

def send_mail(content):
    host = 'smtp.163.com'
    port = 465
    sender = "sender@163.com"
    receiver = ["cpp9999@qq.com",]
    msg = MIMEText(context)
    msg['From'] = "sender2@163.com"
    msg['To'] = "cpp9999@qq.com"
    msg['Subject'] = "smtp of py"

    try:
        smtp = smtplib.SMTP_SSL(host, port)
        smtp.login(sender, 'password')
        smtp.sendmail(sender, receiver, msg.as_string())
    except Exception, e:
        print "failed"


if __name__ == "__main__":
    send_mail("test")

